; Disassembly of the file "z:\ramdisk\home\knoppix\tmp\MATCHDAY.COM"
; 
; CPU Type: Z80
; 
; Created with dZ80 2.0
; 
; on Tuesday, 28 of May 2013 at 07:54 PM
;
;				; This 512 byte code (loader) is used for loading
				; a Spectrum Basic application from CP/M.
				; The application is usually cracked by
				; using a NMI button & NMI routine that saves
				; the upper 48K of Spectrum memory with the
				; "snapshot" of the application at that moment
				; Then the 48K of code is copied to a CP/M disk,
				; the code sequence below is attached in front
				; of it and the result is saved as a .COM file
				; on disk. When the executable .COM obtained this way
				; is run under CP/M, it is loaded into memory
				; starting at 0100h and then run from this
				; address. So the sequence below is always
				; run first. What it does is to move the actual
				; application code (48K) from 0300-C2FF to
				; 4000-FFFF, copy the Spectrum screen portion
				; from the application snapshot into the video
				; memory of CP/M (the game start screen usually),
				; set the stack pointer and load the entry point
				; of the application "snapshot" into the HL register
				; and then change the hardware configuration to BASIC
				; and run the application from the point it was
				; frozen by the NMI cracking procedure.
				; This "loader" code assumes that the entry point
				; in the application snapshot is at 4600h (usually
				; saved as a jump instruction by the NMI cracking
				; procedure), therefore the start screen will have
				; some "garbage" on it. Also the stack being set at
				; 47E8, will be visible on screen.
0000 F3        DI
0001 21FFC2    LD      HL,$C2FF	; > move 48K app code
0004 11FFFF    LD      DE,$FFFF	; > from 0300-C2FF
0007 0100C0    LD      BC,$C000	; > to 4000-FFFF
000A EDB8      LDDR		; > (to std. Spectrum RAM area)
000C 01001B    LD      BC,$1B00	; Spectrum screen mem size
000F 210040    LD      HL,$4000	; app screen data pointer
0012 56        LD      D,(HL)	; <--- <--- <---| read 1 byte of app screen data (from DRAM#1)
0013 3E40      LD      A,$40	;		|
0015 D3FE      OUT     ($FE),A	; set O6 to 1	| (CPU access to VRAM in CP/M)
0017 72        LD      (HL),D	;		| write data to CP/M screen mem
0018 AF        XOR     A	;		|
0019 D3FE      OUT     ($FE),A	; set O6 to 0	| (CPU access to DRAM#1 in CP/M)
001B 23        INC     HL	;		| increment screen data pointer
001C 0B        DEC     BC	;		| decrement Spectrum screen size counter
001D 78        LD      A,B	; test if	|
001E B1        OR      C	; BC=00		|
001F 20F1      JR      NZ,$0012	; ---> ---> --->| restart loop if Spectrum screen size counter > 0
0021 31E847    LD      SP,$47E8	; set stack pointer somewhere in Spectrum screen mem
0024 210046    LD      HL,$4600	; set app entry point somewhere in Spectrum screen mem
0027 3E03      LD      A,$03	;
0029 D3E3      OUT     ($E3),A	; disable
002B D3EB      OUT     ($EB),A	; interrupts
002D D3F3      OUT     ($F3),A	; from
002F D3FB      OUT     ($FB),A	; Z80-CTC
0031 AF        XOR     A	;
0032 D3FD      OUT     ($FD),A	; send invalid command to 8272 (set to standby)
0034 010080    LD      BC,$8000	;
0037 0B        DEC     BC	; <--- <--- <---| this
0038 78        LD      A,B	;		| introduces
0039 B1        OR      C	;		| a short
003A 20FB      JR      NZ,$0037	; ---> ---> --->| delay
003C D9        EXX
003D 3EC1      LD      A,$C1	; set SO to 1, O6 to 1, border to blue
003F D3FE      OUT     ($FE),A	; (SO selects BASIC in a 32K ROM, O6=1 for startup hw config)
0041 ED4F      LD      R,A	; set bit 7 of R to 1 for startup hw config
0043 FF        RST     $38	; after changing to startup hw config, jump to 0038h
0044 00        NOP
0045 00        NOP
0046 00        NOP
0047 00        NOP
0048 00        NOP
0049 00        NOP
004A 00        NOP
004B 00        NOP
004C 00        NOP
004D 00        NOP
004E 00        NOP
004F 00        NOP
0050 00        NOP
0051 00        NOP
0052 00        NOP
0053 00        NOP
0054 00        NOP
0055 00        NOP
0056 00        NOP
0057 00        NOP
0058 00        NOP
0059 00        NOP
005A 00        NOP
005B 00        NOP
005C 00        NOP
005D 00        NOP
005E 00        NOP
005F 00        NOP
0060 00        NOP
0061 00        NOP
0062 00        NOP
0063 00        NOP
0064 00        NOP
0065 00        NOP
0066 00        NOP
0067 00        NOP
0068 00        NOP
0069 00        NOP
006A 00        NOP
006B 00        NOP
006C 00        NOP
006D 00        NOP
006E 00        NOP
006F 00        NOP
0070 00        NOP
0071 00        NOP
0072 00        NOP
0073 00        NOP
0074 00        NOP
0075 00        NOP
0076 00        NOP
0077 00        NOP
0078 00        NOP
0079 00        NOP
007A 00        NOP
007B 00        NOP
007C 00        NOP
007D 00        NOP
007E 00        NOP
007F 00        NOP
0080 00        NOP
0081 00        NOP
0082 00        NOP
0083 00        NOP
0084 00        NOP
0085 00        NOP
0086 00        NOP
0087 00        NOP
0088 00        NOP
0089 00        NOP
008A 00        NOP
008B 00        NOP
008C 00        NOP
008D 00        NOP
008E 00        NOP
008F 00        NOP
0090 00        NOP
0091 00        NOP
0092 00        NOP
0093 00        NOP
0094 00        NOP
0095 00        NOP
0096 00        NOP
0097 00        NOP
0098 00        NOP
0099 00        NOP
009A 00        NOP
009B 00        NOP
009C 00        NOP
009D 00        NOP
009E 00        NOP
009F 00        NOP
00A0 00        NOP
00A1 00        NOP
00A2 00        NOP
00A3 00        NOP
00A4 00        NOP
00A5 00        NOP
00A6 00        NOP
00A7 00        NOP
00A8 00        NOP
00A9 00        NOP
00AA 00        NOP
00AB 00        NOP
00AC 00        NOP
00AD 00        NOP
00AE 00        NOP
00AF 00        NOP
00B0 00        NOP
00B1 00        NOP
00B2 00        NOP
00B3 00        NOP
00B4 00        NOP
00B5 00        NOP
00B6 00        NOP
00B7 00        NOP
00B8 00        NOP
00B9 00        NOP
00BA 00        NOP
00BB 00        NOP
00BC 00        NOP
00BD 00        NOP
00BE 00        NOP
00BF 00        NOP
00C0 00        NOP
00C1 00        NOP
00C2 00        NOP
00C3 00        NOP
00C4 00        NOP
00C5 00        NOP
00C6 00        NOP
00C7 00        NOP
00C8 00        NOP
00C9 00        NOP
00CA 00        NOP
00CB 00        NOP
00CC 00        NOP
00CD 00        NOP
00CE 00        NOP
00CF 00        NOP
00D0 00        NOP
00D1 00        NOP
00D2 00        NOP
00D3 00        NOP
00D4 00        NOP
00D5 00        NOP
00D6 00        NOP
00D7 00        NOP
00D8 00        NOP
00D9 00        NOP
00DA 00        NOP
00DB 00        NOP
00DC 00        NOP
00DD 00        NOP
00DE 00        NOP
00DF 00        NOP
00E0 00        NOP
00E1 00        NOP
00E2 00        NOP
00E3 00        NOP
00E4 00        NOP
00E5 00        NOP
00E6 00        NOP
00E7 00        NOP
00E8 00        NOP
00E9 00        NOP
00EA 00        NOP
00EB 00        NOP
00EC 00        NOP
00ED 00        NOP
00EE 00        NOP
00EF 00        NOP
00F0 00        NOP
00F1 00        NOP
00F2 00        NOP
00F3 00        NOP
00F4 00        NOP
00F5 00        NOP
00F6 00        NOP
00F7 00        NOP
00F8 00        NOP
00F9 00        NOP
00FA 00        NOP
00FB 00        NOP
00FC 00        NOP
00FD 00        NOP
00FE 00        NOP
00FF 00        NOP
0100 00        NOP
0101 00        NOP
0102 00        NOP
0103 00        NOP
0104 00        NOP
0105 00        NOP
0106 00        NOP
0107 00        NOP
0108 00        NOP
0109 00        NOP
010A 00        NOP
010B 00        NOP
010C 00        NOP
010D 00        NOP
010E 00        NOP
010F 00        NOP
0110 00        NOP
0111 00        NOP
0112 00        NOP
0113 00        NOP
0114 00        NOP
0115 00        NOP
0116 00        NOP
0117 00        NOP
0118 00        NOP
0119 00        NOP
011A 00        NOP
011B 00        NOP
011C 00        NOP
011D 00        NOP
011E 00        NOP
011F 00        NOP
0120 00        NOP
0121 00        NOP
0122 00        NOP
0123 00        NOP
0124 00        NOP
0125 00        NOP
0126 00        NOP
0127 00        NOP
0128 00        NOP
0129 00        NOP
012A 00        NOP
012B 00        NOP
012C 00        NOP
012D 00        NOP
012E 00        NOP
012F 00        NOP
0130 00        NOP
0131 00        NOP
0132 00        NOP
0133 00        NOP
0134 00        NOP
0135 00        NOP
0136 00        NOP
0137 00        NOP
0138 00        NOP
0139 00        NOP
013A 00        NOP
013B 00        NOP
013C 00        NOP
013D 00        NOP
013E 00        NOP
013F 00        NOP
0140 00        NOP
0141 00        NOP
0142 00        NOP
0143 00        NOP
0144 00        NOP
0145 00        NOP
0146 00        NOP
0147 00        NOP
0148 00        NOP
0149 00        NOP
014A 00        NOP
014B 00        NOP
014C 00        NOP
014D 00        NOP
014E 00        NOP
014F 00        NOP
0150 00        NOP
0151 00        NOP
0152 00        NOP
0153 00        NOP
0154 00        NOP
0155 00        NOP
0156 00        NOP
0157 00        NOP
0158 00        NOP
0159 00        NOP
015A 00        NOP
015B 00        NOP
015C 00        NOP
015D 00        NOP
015E 00        NOP
015F 00        NOP
0160 00        NOP
0161 00        NOP
0162 00        NOP
0163 00        NOP
0164 00        NOP
0165 00        NOP
0166 00        NOP
0167 00        NOP
0168 00        NOP
0169 00        NOP
016A 00        NOP
016B 00        NOP
016C 00        NOP
016D 00        NOP
016E 00        NOP
016F 00        NOP
0170 00        NOP
0171 00        NOP
0172 00        NOP
0173 00        NOP
0174 00        NOP
0175 00        NOP
0176 00        NOP
0177 00        NOP
0178 00        NOP
0179 00        NOP
017A 00        NOP
017B 00        NOP
017C 00        NOP
017D 00        NOP
017E 00        NOP
017F 00        NOP
0180 00        NOP
0181 00        NOP
0182 00        NOP
0183 00        NOP
0184 00        NOP
0185 00        NOP
0186 00        NOP
0187 00        NOP
0188 00        NOP
0189 00        NOP
018A 00        NOP
018B 00        NOP
018C 00        NOP
018D 00        NOP
018E 00        NOP
018F 00        NOP
0190 00        NOP
0191 00        NOP
0192 00        NOP
0193 00        NOP
0194 00        NOP
0195 00        NOP
0196 00        NOP
0197 00        NOP
0198 00        NOP
0199 00        NOP
019A 00        NOP
019B 00        NOP
019C 00        NOP
019D 00        NOP
019E 00        NOP
019F 00        NOP
01A0 00        NOP
01A1 00        NOP
01A2 00        NOP
01A3 00        NOP
01A4 00        NOP
01A5 00        NOP
01A6 00        NOP
01A7 00        NOP
01A8 00        NOP
01A9 00        NOP
01AA 00        NOP
01AB 00        NOP
01AC 00        NOP
01AD 00        NOP
01AE 00        NOP
01AF 00        NOP
01B0 00        NOP
01B1 00        NOP
01B2 00        NOP
01B3 00        NOP
01B4 00        NOP
01B5 00        NOP
01B6 00        NOP
01B7 00        NOP
01B8 00        NOP
01B9 00        NOP
01BA 00        NOP
01BB 00        NOP
01BC 00        NOP
01BD 00        NOP
01BE 00        NOP
01BF 00        NOP
01C0 00        NOP
01C1 00        NOP
01C2 00        NOP
01C3 00        NOP
01C4 00        NOP
01C5 00        NOP
01C6 00        NOP
01C7 00        NOP
01C8 00        NOP
01C9 00        NOP
01CA 00        NOP
01CB 00        NOP
01CC 00        NOP
01CD 00        NOP
01CE 00        NOP
01CF 00        NOP
01D0 00        NOP
01D1 00        NOP
01D2 00        NOP
01D3 00        NOP
01D4 00        NOP
01D5 00        NOP
01D6 00        NOP
01D7 00        NOP
01D8 00        NOP
01D9 00        NOP
01DA 00        NOP
01DB 00        NOP
01DC 00        NOP
01DD 00        NOP
01DE 00        NOP
01DF 00        NOP
01E0 00        NOP
01E1 00        NOP
01E2 00        NOP
01E3 00        NOP
01E4 00        NOP
01E5 00        NOP
01E6 00        NOP
01E7 00        NOP
01E8 00        NOP
01E9 00        NOP
01EA 00        NOP
01EB 00        NOP
01EC 00        NOP
01ED 00        NOP
01EE 00        NOP
01EF 00        NOP
01F0 00        NOP
01F1 00        NOP
01F2 00        NOP
01F3 00        NOP
01F4 00        NOP
01F5 00        NOP
01F6 00        NOP
01F7 00        NOP
01F8 00        NOP
01F9 00        NOP
01FA 00        NOP
01FB 00        NOP
01FC 00        NOP
01FD 00        NOP
01FE 00        NOP
01FF 00        NOP